//
//  MHDataManager.m
//  ManHua
//
//  Created by lanou on 15/11/2.
//  Copyright © 2015年 蓝欧科技. All rights reserved.
//

#import "MHDataManager.h"

@interface MHDataManager()
@property(nonatomic,strong)FMDatabase *dataBase;

@end
@implementation MHDataManager

//先创建一个单列

+(instancetype)shareManager
{
    static MHDataManager *dataManager=nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        dataManager=[[MHDataManager alloc]init];
        [dataManager createTable];
    });
    return dataManager;
}

-(void)createTable
{
    NSString *filePath=[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:@"ManHua.db"];
    _dataBase=[FMDatabase databaseWithPath:filePath];
    NSLog(@"%@",filePath);
    if ([_dataBase open]) {
        NSLog(@"数据库打开成功");
        //创建表
        
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS TOPICMANMODEL(MoreIDs text,RecommandID integer,Title text,Type text,VisibleIDs text)"];
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS TOPICBANNER (BookIDs text,TopicDescription text, TopicIconUrl text,TopicID integer,TopicName text,TopicType text)"];
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS MHComicIntroduct(BookAuthor text,BookCreationDate text,BookDescription text,BookClickCount integer,BookDownCount integer,BookID integer,BookIconOtherURL text,BookLinkURL text,BookName text, BookState integer,BookStateName text,BookUpdateDate text,BookUpdateSection text,CatalogID integer,CatalogName text,siteURL text,resource_id integer,seq integer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   )"];
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS USERINFO(IsOnline integer,LastLoginDate text,TotalPrice integer,UserBorthday text,UserEmail text,UserForm text,UserID integer,UserNick text,UserOther text,UserPhotoURL text,UserPwd text,UserSex text, icon blob)"];
        
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS ReadList(BookAuthor text,BookCreationDate text,BookDescription text,BookClickCount integer,BookDownCount integer,BookID integer,BookIconOtherURL text,BookLinkURL text,BookName text, BookState integer,BookStateName text,BookUpdateDate text,BookUpdateSection text,CatalogID integer,CatalogName text,siteURL text,resource_id integer,seq integer, readSection text, readPage integer, readSectionIndex integer)"];
        
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS CollectionList(BookAuthor text,BookCreationDate text,BookDescription text,BookClickCount integer,BookDownCount integer,BookID integer,BookIconOtherURL text,BookLinkURL text,BookName text, BookState integer,BookStateName text,BookUpdateDate text,BookUpdateSection text,CatalogID integer,CatalogName text,siteURL text,resource_id integer,seq integer, readSection text, readPage integer, readSectionIndex integer)"];
        
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS CATEGORY( CatalogDescription text,CatalogID integer,CatalogName text,CatalogOtherURL text,CatalogSelfURL text,CatalogTargetURL1 text)"];
        //comicIntroductList
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS COMICINTRODUCTLIST(BookAuthor text,BookCreationDate text,BookDescription text,BookClickCount integer,BookDownCount integer,BookID integer,BookIconOtherURL text,BookLinkURL text,BookName text, BookState integer,BookStateName text,BookUpdateDate text,BookUpdateSection text,CatalogID integer,CatalogName text,siteURL text,resource_id integer,seq integer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  )"];
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS MHHOMECategory(MoreIDs text ,Title text,VisibleIDs text)"];
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS MHHOMECOMICINTRODUCT(BookAuthor text,BookCreationDate text,BookDescription text,BookClickCount integer,BookDownCount integer,BookID integer,BookIconOtherURL text,BookLinkURL text,BookName text, BookState integer,BookStateName text,BookUpdateDate text,BookUpdateSection text,CatalogID integer,CatalogName text,siteURL text,resource_id integer,seq integer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  )"];
        [_dataBase executeUpdate:@"CREATE TABLE IF NOT EXISTS MHMHHomeBanner(image_set_id integer,title text,seq integer,BookAuthor text,BookCreationDate text,BookDescription text,BookClickCount integer,BookDownCount integer,BookID integer,BookIconOtherURL1 text,BookLinkURL text,BookName text, BookState integer,BookStateName text,BookUpdateDate text,BookUpdateSection text,CatalogID integer,CatalogName text,siteURL text,resource_id integer,seq1 integer,BookIconOtherURL text, dt_updated text,desc text,meta_id integer,comic_author text)"];

    }
    else
    {
        NSLog(@"数据库打开失败");
    }

    
    
}

-(NSMutableArray *)getCategoryListData:(NSString *)tableName CategoryID:(NSInteger )categoryID
{
    FMResultSet *result=[_dataBase executeQuery:[NSString stringWithFormat:@"SELECT *FROM %@ where CatalogID =%ld",tableName,categoryID]];
    NSMutableArray *modelArr=[NSMutableArray arrayWithCapacity:0];
    while ([result next]) {
        NSString *BookAuthor=[result stringForColumn:@"BookAuthor"];
        NSString *BookCreationDate=[result stringForColumn:@"BookCreationDate"];
        NSString *BookDescription=[result stringForColumn:@"BookDescription"];
        NSInteger BookClickCount=[result  intForColumn:@"BookClickCount"];
        NSInteger BookDownCount=[result intForColumn:@"BookDownCount"];
        NSInteger BookID=[result intForColumn:@"BookID"];
        NSString * BookIconOtherURL=[result stringForColumn:@"BookIconOtherURL"];
        NSString *BookLinkURL=[result stringForColumn:@"BookLinkURL"];
        NSString *BookName=[result stringForColumn:@"BookName"];
        NSInteger  BookState=[result  intForColumn:@"BookState"];
        NSString *BookStateName=[result stringForColumn:@"BookStateName"];
        NSString *BookUpdateDate=[result stringForColumn:@"BookUpdateDate"];
        NSString *BookUpdateSection=[result stringForColumn:@"BookUpdateSection"];
        NSInteger CatalogID=[result intForColumn:@"CatalogID"];
        NSString *CatalogName=[result stringForColumn:@"CatalogName"];
        NSString *siteURL=[result stringForColumn:@"siteURL"];
        NSInteger resource_id=[result intForColumn:@"resource_id"];
        NSInteger seq=[result intForColumn:@"seq"];
        MHComicIntroduct *comicIntroductModel=[[MHComicIntroduct alloc]init];
        comicIntroductModel.BookAuthor=BookAuthor;
        comicIntroductModel.BookCreationDate=BookCreationDate;
        comicIntroductModel.BookDescription=BookDescription;
        comicIntroductModel.BookClickCount=BookClickCount;
        comicIntroductModel.BookDownCount=BookDownCount;
        comicIntroductModel.BookID=BookID;
        comicIntroductModel.BookIconOtherURL=BookIconOtherURL;
        comicIntroductModel.BookLinkURL=BookLinkURL;
        comicIntroductModel.BookName=BookName;
        comicIntroductModel.BookState=BookState;
        comicIntroductModel.BookStateName=BookStateName;
        comicIntroductModel.BookUpdateDate=BookUpdateDate;
        comicIntroductModel.BookUpdateSection=BookUpdateSection;
        comicIntroductModel.CatalogID=CatalogID;
        comicIntroductModel.CatalogName=CatalogName;
        comicIntroductModel.siteURL=siteURL;
        comicIntroductModel.resource_id = resource_id;
        comicIntroductModel.seq=seq;
        [modelArr  addObject:comicIntroductModel];
    }
    [result close];
    return modelArr;
    
    
}


-(NSMutableArray*)findMainTopicModelData:(NSString *)tableName
{
    FMResultSet *result=[_dataBase executeQuery:[NSString stringWithFormat:@"SELECT *FROM %@",tableName]];
    NSMutableArray *modelArr=[NSMutableArray arrayWithCapacity:0];
    [modelArr removeAllObjects];
    if ([tableName isEqualToString:@"TOPICMANMODEL"]) {
        while ([result next]) {
            NSString *MoreIDs=[result stringForColumn:@"MoreIDs"];
            NSInteger RecommandID=[result intForColumn:@"RecommandID"];
            NSString *Title=[result stringForColumn:@"Title"];
            NSString *Type=[result stringForColumn:@"Type"];
            NSString *VisibleIDs=[result stringForColumn:@"VisibleIDs"];
            MHMainTopicModel *model=[[MHMainTopicModel alloc]init];
            model.MoreIDs=MoreIDs;
            model.RecommandID=RecommandID;
            model.Title=Title;
            model.Type=Type;
            model.VisibleIDs=VisibleIDs;
            [modelArr addObject:model];
        }
        [result close];
        return  modelArr;
    }
    else if ([tableName isEqualToString:@"TOPICBANNER"])
    {
        
        while ([result next]) {
            NSString *BookIDs=[result stringForColumn:@"BookIDs"];
            NSString *TopicDescription=[result stringForColumn:@"TopicDescription"];
            NSString *TopicIconUrl=[result stringForColumn:@"TopicIconUrl"];
            NSInteger TopicID =[result intForColumn:@"TopicID"];
            NSString *TopicName=[result   stringForColumn:@"TopicName"];
            NSString *TopicType=[result stringForColumn:@"TopicType"];
            MHTopicBannerModel *topicBannerModel=[[MHTopicBannerModel alloc]init];
            topicBannerModel.BookIDs=BookIDs;
            topicBannerModel.TopicDescription=TopicDescription;
            topicBannerModel.TopicIconUrl=TopicIconUrl;
            topicBannerModel.TopicID=TopicID;
            topicBannerModel.TopicName=TopicName;
            topicBannerModel.TopicType=TopicType;
            [modelArr addObject:topicBannerModel];
            
        }
        [result close];
        return modelArr;
        
    }
    else if ([tableName isEqualToString:@"MHComicIntroduct"]||[tableName isEqualToString:@"MHHOMECOMICINTRODUCT"])
    {
        while ([result next]) {
            NSString *BookAuthor=[result stringForColumn:@"BookAuthor"];
            NSString *BookCreationDate=[result stringForColumn:@"BookCreationDate"];
            NSString *BookDescription=[result stringForColumn:@"BookDescription"];
            NSInteger BookClickCount=[result  intForColumn:@"BookClickCount"];
            NSInteger BookDownCount=[result intForColumn:@"BookDownCount"];
            NSInteger BookID=[result intForColumn:@"BookID"];
            NSString * BookIconOtherURL=[result stringForColumn:@"BookIconOtherURL"];
            NSString *BookLinkURL=[result stringForColumn:@"BookLinkURL"];
            NSString *BookName=[result stringForColumn:@"BookName"];
            NSInteger  BookState=[result  intForColumn:@"BookState"];
            NSString *BookStateName=[result stringForColumn:@"BookStateName"];
            NSString *BookUpdateDate=[result stringForColumn:@"BookUpdateDate"];
            NSString *BookUpdateSection=[result stringForColumn:@"BookUpdateSection"];
            NSInteger CatalogID=[result intForColumn:@"CatalogID"];
            NSString *CatalogName=[result stringForColumn:@"CatalogName"];
            NSString *siteURL=[result stringForColumn:@"siteURL"];
            NSInteger resource_id=[result intForColumn:@"resource_id"];
            NSInteger seq=[result intForColumn:@"seq"];
            MHComicIntroduct *comicIntroductModel=[[MHComicIntroduct alloc]init];
            comicIntroductModel.BookAuthor=BookAuthor;
            comicIntroductModel.BookCreationDate=BookCreationDate;
            comicIntroductModel.BookDescription=BookDescription;
            comicIntroductModel.BookClickCount=BookClickCount;
            comicIntroductModel.BookDownCount=BookDownCount;
            comicIntroductModel.BookID=BookID;
            comicIntroductModel.BookIconOtherURL=BookIconOtherURL;
            comicIntroductModel.BookLinkURL=BookLinkURL;
            comicIntroductModel.BookName=BookName;
            comicIntroductModel.BookState=BookState;
            comicIntroductModel.BookStateName=BookStateName;
            comicIntroductModel.BookUpdateDate=BookUpdateDate;
            comicIntroductModel.BookUpdateSection=BookUpdateSection;
            comicIntroductModel.CatalogID=CatalogID;
            comicIntroductModel.CatalogName=CatalogName;
            comicIntroductModel.siteURL=siteURL;
            comicIntroductModel.resource_id = resource_id;
            comicIntroductModel.seq=seq;
            [modelArr  addObject:comicIntroductModel];
        }
        [result close];
        return modelArr;
        
        
    }
    else if ([tableName isEqualToString:@"USERINFO"])
    {
        while ([result next]) {
            NSInteger IsOnline=[result intForColumn:@"IsOnline"];
            NSString *LastLoginDate=[result stringForColumn:@"LastLoginDate"];
            NSInteger TotalPrice=[result intForColumn:@"TotalPrice"];
            NSString *UserBorthday=[result stringForColumn:@"UserBorthday"];
            NSString *UserEmail=[result stringForColumn:@"UserEmail"];
            NSString *UserForm=[result stringForColumn:@"UserForm"];
            NSInteger UserID=[result intForColumn:@"UserID"];
            NSString *UserNick=[result stringForColumn:@"UserNick"];
            NSString *UserOther=[result stringForColumn:@"UserOther"];
            NSString *UserPhotoURL=[result stringForColumn:@"UserPhotoURL"];
            NSString *UserPwd=[result stringForColumn:@"UserPwd"];
            NSString *UserSex=[result stringForColumn:@"UserSex"];
            MHUserInfo *userInfo=[[MHUserInfo alloc]init];
            userInfo.IsOnline=IsOnline;
            userInfo.LastLoginDate=LastLoginDate;
            userInfo.TotalPrice = TotalPrice;
            userInfo.UserBorthday = UserBorthday;
            userInfo.UserEmail =UserEmail;
            userInfo.UserForm=UserForm;
            userInfo.UserID=UserID;
            userInfo.UserNick=UserNick;
            userInfo.UserOther=UserOther;
            userInfo.UserPhotoURL=UserPhotoURL;
            userInfo.UserPwd=UserPwd;
            userInfo.UserSex=UserSex;
            [modelArr addObject:userInfo];
        }
        [result close];
        return modelArr;
    }
    else if ([tableName isEqualToString:@"CATEGORY"])
    {
        while ([result next]) {
            NSString *CatalogDescription=[result stringForColumn:@"CatalogDescription"];
            NSInteger CatalogID=[result intForColumn:@"CatalogID"];
            NSString *CatalogName=[result stringForColumn:@"CatalogName"];
            NSString *CatalogOtherURL=[result stringForColumn:@"CatalogOtherURL"];
            NSString *CatalogSelfURL=[result stringForColumn:@"CatalogSelfURL"];
            NSString *CatalogTargetURL1=[result stringForColumn:@"CatalogTargetURL1"];
            MHCategory *categoryModel=[[MHCategory alloc]init];
            categoryModel.CatalogDescription=CatalogDescription;
            categoryModel.CatalogID=CatalogID;
            categoryModel.CatalogName=CatalogName;
            categoryModel.CatalogOtherURL=CatalogOtherURL;
            categoryModel.CatalogSelfURL=CatalogSelfURL;
            categoryModel.CatalogTargetURL1=CatalogTargetURL1;
            [modelArr addObject:categoryModel];
        }
        [result close];
        return modelArr;
        
    }
    else if ([tableName isEqualToString:@"MHHOMECategory"])
    {
        while ([result next]) {
            NSString *MoreIDs=[NSString stringWithFormat:@"MoreIDs"];
            NSString *Title=[NSString stringWithFormat:@"Title"];
            NSString *VisibleIDs=[NSString stringWithFormat:@"VisibleIDs"];
            MHHomeCategory *homeCategory=[[MHHomeCategory alloc]init];
            homeCategory.MoreIDs=MoreIDs;
            homeCategory.Title = Title;
            homeCategory.VisibleIDs =VisibleIDs;
            [modelArr addObject:homeCategory];
        }
        [result close];
        return modelArr;
        
    }
    else if ([tableName isEqualToString:@"MHMHHomeBanner"])
    {
        while ([result next]) {
            
            
            NSString *BookAuthor=[result stringForColumn:@"BookAuthor"];
            NSString *BookCreationDate=[result stringForColumn:@"BookCreationDate"];
            NSString *BookDescription=[result stringForColumn:@"BookDescription"];
            NSInteger BookClickCount=[result  intForColumn:@"BookClickCount"];
            NSInteger BookDownCount=[result intForColumn:@"BookDownCount"];
            NSInteger BookID=[result intForColumn:@"BookID"];
            NSString * BookIconOtherURL1=[result stringForColumn:@"BookIconOtherURL1"];
            NSString *BookLinkURL=[result stringForColumn:@"BookLinkURL"];
            NSString *BookName=[result stringForColumn:@"BookName"];
            NSInteger  BookState=[result  intForColumn:@"BookState"];
            NSString *BookStateName=[result stringForColumn:@"BookStateName"];
            NSString *BookUpdateDate=[result stringForColumn:@"BookUpdateDate"];
            NSString *BookUpdateSection=[result stringForColumn:@"BookUpdateSection"];
            NSInteger CatalogID=[result intForColumn:@"CatalogID"];
            NSString *CatalogName=[result stringForColumn:@"CatalogName"];
            NSString *siteURL=[result stringForColumn:@"siteURL"];
            NSInteger resource_id=[result intForColumn:@"resource_id"];
            NSInteger seq1=[result intForColumn:@"seq1"];
            NSInteger seq=[result intForColumn:@"seq"];
            NSInteger image_set_id=[result intForColumn:@"image_set_id"];
            NSString *title=[result stringForColumn:@"title"];
            NSString *BookIconOtherURL=[result stringForColumn:@"BookIconOtherURL"];
            NSString *dt_updated=[result stringForColumn:@"dt_updated"];
            NSString *desc=[result stringForColumn:@"desc"];
            NSInteger meta_id=[result intForColumn:@"meta_id"];
            NSString *comic_author=[result stringForColumn:@"comic_author"];
            MHComicIntroduct *comicIntroductModel=[[MHComicIntroduct alloc]init];
            comicIntroductModel.BookAuthor=BookAuthor;
            comicIntroductModel.BookCreationDate=BookCreationDate;
            comicIntroductModel.BookDescription=BookDescription;
            comicIntroductModel.BookClickCount=BookClickCount;
            comicIntroductModel.BookDownCount=BookDownCount;
            comicIntroductModel.BookID=BookID;
            comicIntroductModel.BookIconOtherURL=BookIconOtherURL1;
            comicIntroductModel.BookLinkURL=BookLinkURL;
            comicIntroductModel.BookName=BookName;
            comicIntroductModel.BookState=BookState;
            comicIntroductModel.BookStateName=BookStateName;
            comicIntroductModel.BookUpdateDate=BookUpdateDate;
            comicIntroductModel.BookUpdateSection=BookUpdateSection;
            comicIntroductModel.CatalogID=CatalogID;
            comicIntroductModel.CatalogName=CatalogName;
            comicIntroductModel.siteURL=siteURL;
            comicIntroductModel.resource_id = resource_id;
            comicIntroductModel.seq=seq1;
            MHHomeBanner *homeBannerModel=[[MHHomeBanner alloc]init];
            homeBannerModel.comicIntroduct=comicIntroductModel;
            homeBannerModel.title=title;
            homeBannerModel.image_set_id=image_set_id;
            homeBannerModel.BookIconOtherURL=BookIconOtherURL;
            homeBannerModel.dt_updated=dt_updated;
            homeBannerModel.meta_id=meta_id;
            homeBannerModel.comic_author=comic_author;
            homeBannerModel.desc=desc;
            homeBannerModel.seq=seq;
            [modelArr addObject:homeBannerModel];
            
        }
        [result close];
        return modelArr;
        
        
    }
    
    return nil;
}

-(void)insertValueToTabel:(NSString *)tableName category:(MHCategory *)categoryModel
{
    [_dataBase executeUpdate:[NSString stringWithFormat:@"INSERT INTO %@(CatalogDescription,CatalogID,CatalogName,CatalogOtherURL,CatalogSelfURL,CatalogTargetURL1)VALUES(?,?,?,?,?,?)",tableName],categoryModel.CatalogDescription,[NSNumber numberWithInteger:categoryModel.CatalogID],categoryModel.CatalogName,categoryModel.CatalogOtherURL,categoryModel.CatalogSelfURL,categoryModel.CatalogTargetURL1];
    
}

-(void)deleteValueFromeTable:(NSString *)tableName
{
    [_dataBase executeUpdate:[NSString stringWithFormat:@"DELETE FROM %@",tableName]];

}

-(void)insertValueToTabel:(NSString *)tableName bannerModel:(MHTopicBannerModel *)bannerModel
{
  
        [_dataBase executeUpdate:[NSString stringWithFormat:@"INSERT INTO %@(BookIDs,TopicDescription,TopicIconUrl,TopicID,TopicName,TopicType)VALUES(?,?,?,?,?,?)" ,tableName],bannerModel.BookIDs,bannerModel.TopicDescription,bannerModel.TopicIconUrl,[NSNumber numberWithInteger: bannerModel.TopicID],bannerModel.TopicName,bannerModel.TopicType];
 

}

-(void)insertValueToTabel:(NSString *)tableName mainTopicModel:(MHMainTopicModel *)mainTopicModel
{
   
    [_dataBase executeUpdate:[NSString stringWithFormat: @"INSERT INTO %@(MoreIDs,RecommandID,Title,Type,VisibleIDs)VALUES(?,?,?,?,?)",tableName],mainTopicModel.MoreIDs,[NSNumber numberWithInteger:mainTopicModel.RecommandID],mainTopicModel.Title,mainTopicModel.Type,mainTopicModel.VisibleIDs];


}

-(void)insertValueToTabel:(NSString *)tableName ComicIntroduce:(MHComicIntroduct *)mainBookModel categoryID:(NSInteger)categoryID
{
    [_dataBase executeUpdate:[NSString stringWithFormat:@"INSERT INTO %@ (BookAuthor,BookCreationDate,BookDescription,BookClickCount,BookDownCount,BookID,BookIconOtherURL,BookLinkURL,BookName,BookState,BookStateName,BookUpdateDate,BookUpdateSection,CatalogID,CatalogName,siteURL,resource_id, seq)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ",tableName],mainBookModel.BookAuthor,mainBookModel.BookCreationDate,mainBookModel.BookDescription,[NSNumber numberWithInteger:mainBookModel.BookClickCount],[NSNumber numberWithInteger:mainBookModel.BookDownCount],[NSNumber numberWithInteger:mainBookModel.BookID],mainBookModel.BookIconOtherURL,mainBookModel.BookLinkURL,mainBookModel.BookName, [NSNumber numberWithInteger:mainBookModel.BookState],mainBookModel.BookStateName,mainBookModel.BookUpdateDate, mainBookModel.BookUpdateSection, [NSNumber numberWithInteger: categoryID ],mainBookModel.CatalogName,mainBookModel.siteURL,[NSNumber numberWithInteger: mainBookModel.resource_id], [NSNumber numberWithInteger:mainBookModel.seq]];
    
}


-(void)insertValueToTabel:(NSString *)tableName ComicIntroduce:(MHComicIntroduct *)mainBookModel
{
    [_dataBase executeUpdate:[NSString stringWithFormat:@"INSERT INTO %@ (BookAuthor,BookCreationDate,BookDescription,BookClickCount,BookDownCount,BookID,BookIconOtherURL,BookLinkURL,BookName,BookState,BookStateName,BookUpdateDate,BookUpdateSection,CatalogID,CatalogName,siteURL,resource_id, seq)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ",tableName],mainBookModel.BookAuthor,mainBookModel.BookCreationDate,mainBookModel.BookDescription,[NSNumber numberWithInteger:mainBookModel.BookClickCount],[NSNumber numberWithInteger:mainBookModel.BookDownCount],[NSNumber numberWithInteger:mainBookModel.BookID],mainBookModel.BookIconOtherURL,mainBookModel.BookLinkURL,mainBookModel.BookName, [NSNumber numberWithInteger:mainBookModel.BookState],mainBookModel.BookStateName,mainBookModel.BookUpdateDate, mainBookModel.BookUpdateSection, [NSNumber numberWithInteger: mainBookModel.CatalogID ],mainBookModel.CatalogName,mainBookModel.siteURL,[NSNumber numberWithInteger: mainBookModel.resource_id], [NSNumber numberWithInteger:mainBookModel.seq]];

}

-(void)insertUserInfo:(MHUserInfo *)userInfoModel
{
    NSData *imageData = UIImagePNGRepresentation(userInfoModel.icon);//将png图片转化为nsdata
    [_dataBase executeUpdate:[NSString stringWithFormat:@"INSERT INTO USERINFO VALUES(?,?,?,?,?,?,?,?,?,?,?,?, ?)"],[NSNumber numberWithInteger:userInfoModel.IsOnline],userInfoModel.LastLoginDate,[NSNumber numberWithInteger:userInfoModel.TotalPrice],userInfoModel.UserBorthday,userInfoModel.UserEmail,userInfoModel.UserForm,[NSNumber numberWithInteger:userInfoModel.UserID],userInfoModel.UserNick,userInfoModel.UserOther,userInfoModel.UserPhotoURL,userInfoModel.UserPwd,userInfoModel.UserSex, imageData];
    
}
-(void)deleteFromTable:(NSString *)tableName CategoryID:(NSInteger )categoryID
{
    [_dataBase executeUpdate:[NSString stringWithFormat:@"DELETE FROM %@ where CatalogID = %ld",tableName,categoryID]];
    
}
- (void)insertUserIcon:(UIImage *)icon UserInfo:(MHUserInfo *)userInfo
{
    NSData *imageData = UIImagePNGRepresentation(icon);//将png图片转化为nsdata
    [_dataBase executeUpdate:[NSString stringWithFormat:@"update USERINFO set icon = ? where UserID = %ld", userInfo.UserID] imageData:imageData];
}

- (void)updateUserBirthday:(NSString *)birthday UserInfo:(MHUserInfo *)userInfo
{
    [_dataBase executeUpdate:@"update USERINFO set UserBorthday = ? where UserID = ?", birthday, [NSNumber numberWithInteger:userInfo.UserID]];
}

- (void)updateUserNick:(NSString *)nick UserInfo:(MHUserInfo *)userInfo
{
    [_dataBase executeUpdate:@"update USERINFO set UserNick = ? where UserID = ?", nick, [NSNumber numberWithInteger:userInfo.UserID]];
}

- (void)updateUserOther:(NSString *)other UserInfo:(MHUserInfo *)userInfo
{
    [_dataBase executeUpdate:@"update USERINFO set UserOther = ? where UserID = ?", other, [NSNumber numberWithInteger:userInfo.UserID]];

}

- (void)updateUserSex:(NSString *)sex UserInfo:(MHUserInfo *)userInfo
{
    [_dataBase executeUpdate:@"update USERINFO set UserSex = ? where UserID = ?", sex, [NSNumber numberWithInteger:userInfo.UserID]];
}

- (void)insertComicIntroduct:(MHComicIntroduct *)comicIntroduct WithTableName:(NSString *)tableName
{
    [_dataBase executeUpdate:[NSString stringWithFormat:@"INSERT INTO %@ VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?, ?, ?) ", tableName],comicIntroduct.BookAuthor,comicIntroduct.BookCreationDate,comicIntroduct.BookDescription,[NSNumber numberWithInteger:comicIntroduct.BookClickCount],[NSNumber numberWithInteger:comicIntroduct.BookDownCount],[NSNumber numberWithInteger:comicIntroduct.BookID],comicIntroduct.BookIconOtherURL,comicIntroduct.BookLinkURL,comicIntroduct.BookName, [NSNumber numberWithInteger:comicIntroduct.BookState],comicIntroduct.BookStateName,comicIntroduct.BookUpdateDate, comicIntroduct.BookUpdateSection, [NSNumber numberWithInteger: comicIntroduct.CatalogID ],comicIntroduct.CatalogName,comicIntroduct.siteURL,[NSNumber numberWithInteger: comicIntroduct.resource_id], [NSNumber numberWithInteger:comicIntroduct.seq], comicIntroduct.readSection, [NSNumber numberWithInteger:comicIntroduct.readPage], [NSNumber numberWithInteger:comicIntroduct.readSectionIndex]];
}

- (void)insertReadListWithComicIntroduct:(MHComicIntroduct *)comicIntroduct
{
    [self insertComicIntroduct:comicIntroduct WithTableName:@"ReadList"];
}

- (void)insertCollectionListWithComicIntroduct:(MHComicIntroduct *)comicIntroduct
{
    [self insertComicIntroduct:comicIntroduct WithTableName:@"CollectionList"];
}

- (BOOL)ComicIntroductHasInReadList:(MHComicIntroduct *)comicIntroduct
{
    BOOL hasExist = NO;
    FMResultSet *result=[_dataBase executeQuery:[NSString stringWithFormat:@"SELECT *FROM ReadList Where BookID = %ld", comicIntroduct.BookID]];
    while ([result next]) {
        hasExist = YES;
    }
    [result close];

    return hasExist;
}

- (BOOL)ComicIntroductHasInCollectionList:(MHComicIntroduct *)comicIntroduct
{
    BOOL hasExist = NO;
    FMResultSet *result=[_dataBase executeQuery:[NSString stringWithFormat:@"SELECT *FROM CollectionList Where BookID = %ld", comicIntroduct.BookID]];
    while ([result next]) {
        hasExist = YES;
    }
    [result close];
    
    return hasExist;
}

- (void)updateReadListtWithComicIntroduct:(MHComicIntroduct *)comicIntroduct
{
     [self.dataBase executeUpdate:@"update ReadList set readSection = ?, readSectionIndex = ?, readPage = ? Where BookID = ?", comicIntroduct.readSection, [NSNumber numberWithInteger:comicIntroduct.readSectionIndex], [NSNumber numberWithInteger:comicIntroduct.readPage], [NSNumber numberWithInteger:comicIntroduct.BookID]];
}

- (void)deleteCollectionListtWithComicIntroduct:(MHComicIntroduct *)comicIntroduct
{
    [self.dataBase executeUpdate:@"delete from CollectionList Where BookID = ?", [NSNumber numberWithInteger:comicIntroduct.BookID]];
}

- (NSArray *)getTable:(NSString *)tableName
{
    FMResultSet *result=[_dataBase executeQuery:[NSString stringWithFormat:@"SELECT *FROM %@", tableName]];
    NSMutableArray *modelArr=[NSMutableArray arrayWithCapacity:0];
    while ([result next]) {
        NSString *BookAuthor=[result stringForColumn:@"BookAuthor"];
        NSString *BookCreationDate=[result stringForColumn:@"BookCreationDate"];
        NSString *BookDescription=[result stringForColumn:@"BookDescription"];
        NSInteger BookClickCount=[result  intForColumn:@"BookClickCount"];
        NSInteger BookDownCount=[result intForColumn:@"BookDownCount"];
        NSInteger BookID=[result intForColumn:@"BookID"];
        NSString * BookIconOtherURL=[result stringForColumn:@"BookIconOtherURL"];
        NSString *BookLinkURL=[result stringForColumn:@"BookLinkURL"];
        NSString *BookName=[result stringForColumn:@"BookName"];
        NSInteger  BookState=[result  intForColumn:@"BookState"];
        NSString *BookStateName=[result stringForColumn:@"BookStateName"];
        NSString *BookUpdateDate=[result stringForColumn:@"BookUpdateDate"];
        NSString *BookUpdateSection=[result stringForColumn:@"BookUpdateSection"];
        NSInteger CatalogID=[result intForColumn:@"CatalogID"];
        NSString *CatalogName=[result stringForColumn:@"CatalogName"];
        NSString *siteURL=[result stringForColumn:@"siteURL"];
        NSInteger resource_id=[result intForColumn:@"resource_id"];
        NSInteger seq=[result intForColumn:@"seq"];
        MHComicIntroduct *comicIntroductModel=[[MHComicIntroduct alloc]init];
        comicIntroductModel.BookAuthor=BookAuthor;
        comicIntroductModel.BookCreationDate=BookCreationDate;
        comicIntroductModel.BookDescription=BookDescription;
        comicIntroductModel.BookClickCount=BookClickCount;
        comicIntroductModel.BookDownCount=BookDownCount;
        comicIntroductModel.BookID=BookID;
        comicIntroductModel.BookIconOtherURL=BookIconOtherURL;
        comicIntroductModel.BookLinkURL=BookLinkURL;
        comicIntroductModel.BookName=BookName;
        comicIntroductModel.BookState=BookState;
        comicIntroductModel.BookStateName=BookStateName;
        comicIntroductModel.BookUpdateDate=BookUpdateDate;
        comicIntroductModel.BookUpdateSection=BookUpdateSection;
        comicIntroductModel.CatalogID=CatalogID;
        comicIntroductModel.CatalogName=CatalogName;
        comicIntroductModel.siteURL=siteURL;
        comicIntroductModel.resource_id = resource_id;
        comicIntroductModel.seq=seq;
        comicIntroductModel.readPage = [result intForColumn:@"readPage"];
        comicIntroductModel.readSection = [result stringForColumn:@"readSection"];
        comicIntroductModel.readSectionIndex = [result intForColumn:@"readSectionIndex"];
        [modelArr  addObject:comicIntroductModel];
    }
    [result close];

    return modelArr;
}

- (NSArray *)getCollectionList
{
    return [self getTable:@"CollectionList"];
}

- (NSArray *)getReadList
{
    return [self getTable:@"ReadList"];
}

- (MHComicIntroduct *)getComicIntroductWithBookID:(NSInteger)bookId INTable:(NSString *)tableName
{
    FMResultSet *result=[_dataBase executeQuery:[NSString stringWithFormat:@"SELECT *FROM %@ where BookID = %ld", tableName, bookId]];
    MHComicIntroduct *comicIntroductModel = [[MHComicIntroduct alloc]init];
    while ([result next]) {
        NSString *BookAuthor=[result stringForColumn:@"BookAuthor"];
        NSString *BookCreationDate=[result stringForColumn:@"BookCreationDate"];
        NSString *BookDescription=[result stringForColumn:@"BookDescription"];
        NSInteger BookClickCount=[result  intForColumn:@"BookClickCount"];
        NSInteger BookDownCount=[result intForColumn:@"BookDownCount"];
        NSInteger BookID=[result intForColumn:@"BookID"];
        NSString * BookIconOtherURL=[result stringForColumn:@"BookIconOtherURL"];
        NSString *BookLinkURL=[result stringForColumn:@"BookLinkURL"];
        NSString *BookName=[result stringForColumn:@"BookName"];
        NSInteger  BookState=[result  intForColumn:@"BookState"];
        NSString *BookStateName=[result stringForColumn:@"BookStateName"];
        NSString *BookUpdateDate=[result stringForColumn:@"BookUpdateDate"];
        NSString *BookUpdateSection=[result stringForColumn:@"BookUpdateSection"];
        NSInteger CatalogID=[result intForColumn:@"CatalogID"];
        NSString *CatalogName=[result stringForColumn:@"CatalogName"];
        NSString *siteURL=[result stringForColumn:@"siteURL"];
        NSInteger resource_id=[result intForColumn:@"resource_id"];
        NSInteger seq=[result intForColumn:@"seq"];
        comicIntroductModel.BookAuthor=BookAuthor;
        comicIntroductModel.BookCreationDate=BookCreationDate;
        comicIntroductModel.BookDescription=BookDescription;
        comicIntroductModel.BookClickCount=BookClickCount;
        comicIntroductModel.BookDownCount=BookDownCount;
        comicIntroductModel.BookID=BookID;
        comicIntroductModel.BookIconOtherURL=BookIconOtherURL;
        comicIntroductModel.BookLinkURL=BookLinkURL;
        comicIntroductModel.BookName=BookName;
        comicIntroductModel.BookState=BookState;
        comicIntroductModel.BookStateName=BookStateName;
        comicIntroductModel.BookUpdateDate=BookUpdateDate;
        comicIntroductModel.BookUpdateSection=BookUpdateSection;
        comicIntroductModel.CatalogID=CatalogID;
        comicIntroductModel.CatalogName=CatalogName;
        comicIntroductModel.siteURL=siteURL;
        comicIntroductModel.resource_id = resource_id;
        comicIntroductModel.seq=seq;
        comicIntroductModel.readPage = [result intForColumn:@"readPage"];
        comicIntroductModel.readSection = [result stringForColumn:@"readSection"];
        comicIntroductModel.readSectionIndex = [result intForColumn:@"readSectionIndex"];
    }
    [result close];
    
    return comicIntroductModel;

}

- (MHComicIntroduct *)getComicIntroductWithBookID:(NSInteger)bookId
{
    return [self getComicIntroductWithBookID:bookId INTable:@"ReadList"];
}

- (MHUserInfo *)getUserInfo
{
    FMResultSet *result=[_dataBase executeQuery:[NSString stringWithFormat:@"SELECT *FROM USERINFO"]];
    MHUserInfo *userInfo=[[MHUserInfo alloc]init];
    while ([result next]) {
        NSInteger IsOnline=[result intForColumn:@"IsOnline"];
        NSString *LastLoginDate=[result stringForColumn:@"LastLoginDate"];
        NSInteger TotalPrice=[result intForColumn:@"TotalPrice"];
        NSString *UserBorthday=[result stringForColumn:@"UserBorthday"];
        NSString *UserEmail=[result stringForColumn:@"UserEmail"];
        NSString *UserForm=[result stringForColumn:@"UserForm"];
        NSInteger UserID=[result intForColumn:@"UserID"];
        NSString *UserNick=[result stringForColumn:@"UserNick"];
        NSString *UserOther=[result stringForColumn:@"UserOther"];
        NSString *UserPhotoURL=[result stringForColumn:@"UserPhotoURL"];
        NSString *UserPwd=[result stringForColumn:@"UserPwd"];
        NSString *UserSex=[result stringForColumn:@"UserSex"];
        userInfo.IsOnline=IsOnline;
        userInfo.LastLoginDate=LastLoginDate;
        userInfo.TotalPrice = TotalPrice;
        userInfo.UserBorthday = UserBorthday;
        userInfo.UserEmail =UserEmail;
        userInfo.UserForm=UserForm;
        userInfo.UserID=UserID;
        userInfo.UserNick=UserNick;
        userInfo.UserOther=UserOther;
        userInfo.UserPhotoURL=UserPhotoURL;
        userInfo.UserPwd=UserPwd;
        userInfo.UserSex=UserSex;
        userInfo.icon = [UIImage imageWithData:[result dataForColumn:@"icon"]];
    }
    [result close];
    return userInfo;
}

- (void)deleteUserInfo
{
    [_dataBase executeUpdate:[NSString stringWithFormat:@"DELETE FROM USERINFO"]];
}

-(void)insertValueToTabel:(NSString *)tableName homeCategory:(MHHomeCategory *)homeCategory
{
    [_dataBase executeUpdate:[NSString stringWithFormat:@"INSERT INTO %@(MoreIDs,Title,VisibleIDs)VALUES(?,?,?) ",tableName],homeCategory.MoreIDs,homeCategory.Title,homeCategory.VisibleIDs];
}
-(void)insertValueToTabel:(NSString *)tableName homeBanner:(MHHomeBanner *)homeBannerModel
{
    
    [_dataBase executeUpdate:[NSString stringWithFormat:@"INSERT INTO %@ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",tableName],[NSNumber numberWithInteger:homeBannerModel.image_set_id],homeBannerModel.title,[NSNumber numberWithInteger:homeBannerModel.seq],homeBannerModel.comicIntroduct.BookAuthor,homeBannerModel.comicIntroduct.BookCreationDate,homeBannerModel.comicIntroduct.BookDescription,[NSNumber numberWithInteger:homeBannerModel.comicIntroduct.BookClickCount],[NSNumber numberWithInteger:homeBannerModel.comicIntroduct.BookDownCount],[NSNumber numberWithInteger:homeBannerModel.comicIntroduct.BookID],homeBannerModel.comicIntroduct.BookIconOtherURL,homeBannerModel.comicIntroduct.BookLinkURL,homeBannerModel.comicIntroduct.BookName,[NSNumber numberWithInteger:homeBannerModel.comicIntroduct.BookState],homeBannerModel.comicIntroduct.BookStateName,homeBannerModel.comicIntroduct.BookUpdateDate,homeBannerModel.comicIntroduct.BookUpdateSection,[NSNumber numberWithInteger:homeBannerModel.comicIntroduct.CatalogID],homeBannerModel.comicIntroduct.CatalogName,homeBannerModel.comicIntroduct.siteURL,[NSNumber numberWithInteger:homeBannerModel.comicIntroduct.resource_id],[NSNumber numberWithInteger:homeBannerModel.comicIntroduct.seq],homeBannerModel.BookIconOtherURL,homeBannerModel.dt_updated,homeBannerModel.desc,[NSNumber numberWithInteger:homeBannerModel.meta_id],homeBannerModel.comic_author];
}

- (void)updateImage:(NSString *)imageurl homeBanner:(MHHomeBanner *)homeBanner
{
    [_dataBase executeUpdate:@"update MHMHHomeBanner set BookIconOtherURL = ? where meta_id = ?", imageurl, [NSNumber numberWithInteger:homeBanner.meta_id]];
}


@end
